<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2022/3/10
 * Time: 10:20
 */

namespace app\api\controller;
use app\common\controller\Api;
use think\Db;
use think\Request;

class Scheme extends Api
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';

    public function add()
    {
        if (!Request::instance()->isPost())
            $this->error('请求方式不正确');
        $params = input('post.');
        $params['createtime'] = time();
        $result = $this->validate($params,'Scheme');

        if (true !== $result) {
            // 验证失败 输出错误信息
            $this->error($result);
        }

        $res = Db::name('get_scheme')->insert($params);
        if($res)
            $this->success('申请成功');
        $this->error('申请失败');
    }
}